package pl.ydp.components.mathcell.mathrecognizer.engine.database.modelsets.math_basic.characters
{
	import pl.ydp.components.mathcell.mathrecognizer.characters.Character;
	import pl.ydp.components.mathcell.mathrecognizer.geometry.classification.PrimitiveType;
	import pl.ydp.components.mathcell.mathrecognizer.model.PrimitivesRelation;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescription;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescriptorType;
	import pl.ydp.components.mathcell.mathrecognizer.model.ShapeModel;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ConnectionsDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.LocationDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ObjectDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.SizeDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.presets.PrimitivePresets;
	
	public class MB_ch_2
	{
		public static const MODELS_COUNT:Number = 3;
		
		//---------------------------------------------------
		
		public static function getModels():Array{
			
			var twoShapeModels:Array = new Array();
			
			twoShapeModels.push(getModel0());
			twoShapeModels.push(getModel1());	
			twoShapeModels.push(getModel2());	
			twoShapeModels.push(getModel3());		
			
			return twoShapeModels;
		}
		
		
		//---------------------------------------------------
		
		private static function getModel0():ShapeModel{
			var two:ShapeModel;
			var name:String = "MB_2RND";
			var two_prim:Array = new Array();
			var two_ref:Array = new Array();
			var two_rel:Array = new Array();
			
			two_prim.push(PrimitiveType.CURVE_NE, PrimitiveType.LINE0);
			
			two_ref.push(0,1,PrimitivePresets.RLT_CENTER_DOT, PrimitivePresets.RLT_FULL, PrimitivePresets.RLT_LOWER_QUARTER);
			
			two_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 5, 
															ObjectDescriptor.END, ObjectDescriptor.BEGIN)) );
															
			two_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM)));
			
			two_rel.push(new RelationDescription(0,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.BEGIN)));
			
			two_rel.push(new RelationDescription(0,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.HEIGHT | SizeDescriptor.ABOUT_25, 10)));
			
			
			two_rel.push(new RelationDescription(1,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.WIDTH | SizeDescriptor.LONGER | SizeDescriptor.HALF, 7)));
			
			two_rel.push(new RelationDescription(1,4,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.INSIDE_WHOLE, 7)));
			
			
			two = new ShapeModel(Character.TWO, two_prim, two_ref, two_rel, new Array(), name);
			
			return two;	
		}
		
		//---------------------------------------------------
				
		private static function getModel1():ShapeModel{
			var two:ShapeModel;
			var name:String = "MB_2RND+LNE";
			var two_prim:Array = new Array();
			var two_ref:Array = new Array();
			var two_rel:Array = new Array();
			
			two_prim.push(PrimitiveType.CURVE_NE, PrimitiveType.LINE3, PrimitiveType.LINE0);
			
			two_ref.push(0,1,2,PrimitivePresets.RLT_CENTER_DOT, PrimitivePresets.RLT_FULL, PrimitivePresets.RLT_LOWER_QUARTER);
			
			two_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, 
															ObjectDescriptor.END, ObjectDescriptor.END_EASTERN)) );
															
			two_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM)));
			
			two_rel.push(new RelationDescription(0,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 7, ObjectDescriptor.BEGIN)));
			

			two_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, 
															ObjectDescriptor.END_WESTERN, ObjectDescriptor.END_WESTERN)) );
															
			two_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM)));
			
			
			two_rel.push(new RelationDescription(2,4,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.WIDTH | SizeDescriptor.LONGER | SizeDescriptor.HALF, 7)));
			
			two_rel.push(new RelationDescription(2,5,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.INSIDE_WHOLE, 7)));
			
			
			two = new ShapeModel(Character.TWO, two_prim, two_ref, two_rel, new Array(), name);
			
			return two;	
		}
		
		//---------------------------------------------------
		
		private static function getModel2():ShapeModel{
			var two:ShapeModel;
			var name:String = "MB_2ANGLR";
			var two_prim:Array = new Array();
			var two_ref:Array = new Array();
			var two_rel:Array = new Array();
			
			two_prim.push(PrimitiveType.LINE0 | PrimitiveType.LINE3, PrimitiveType.LINE3, PrimitiveType.LINE0);
			
			two_ref.push(0,1,2,PrimitivePresets.RLT_CENTER_DOT,PrimitivePresets.RLT_FULL, PrimitivePresets.RLT_UPPER_QUARTER, PrimitivePresets.RLT_LOWER_QUARTER);
			
			two_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 10, 
				ObjectDescriptor.END_EASTERN, ObjectDescriptor.END_EASTERN)) );
			two_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10)));
			two_rel.push(new RelationDescription(0,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10)));
			two_rel.push(new RelationDescription(0,4,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.WIDTH | SizeDescriptor.LONGER | SizeDescriptor.HALF, 7)));
			two_rel.push(new RelationDescription(0,5,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.INSIDE, 7)));
			
			
			two_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 10, 
				ObjectDescriptor.END_WESTERN, ObjectDescriptor.END_WESTERN)) );
			two_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM)));
			two_rel.push(new RelationDescription(1,4,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.HEIGHT | SizeDescriptor.LONGER | SizeDescriptor.HALF, 7)));
			two_rel.push(new RelationDescription(1,5,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.INSIDE, 5, ObjectDescriptor.END_EASTERN)));
			two_rel.push(new RelationDescription(1,6,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.INSIDE, 5, ObjectDescriptor.END_WESTERN)));
			
			
			two_rel.push(new RelationDescription(2,6,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.INSIDE, 7)));
			
			
			two = new ShapeModel(Character.TWO, two_prim, two_ref, two_rel, new Array(), name);
			
			return two;	
		}
		
		//---------------------------------------------------
		
		private static function getModel3():ShapeModel{
			var two:ShapeModel;
			var name:String = "MB_2_RND+RND";
			var two_prim:Array = new Array();
			var two_ref:Array = new Array();
			var two_rel:Array = new Array();
			
			two_prim.push(PrimitiveType.CURVE_NE, PrimitiveType.CURVE_NORTH);
			
			two_ref.push(0,1,PrimitivePresets.RLT_CENTER_DOT, PrimitivePresets.RLT_FULL, PrimitivePresets.RLT_LOWER_QUARTER);
			
			two_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 5, 
				ObjectDescriptor.END, ObjectDescriptor.BEGIN)) );
			
			two_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM)));
			
			two_rel.push(new RelationDescription(0,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.BEGIN)));
			
			two_rel.push(new RelationDescription(0,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.HEIGHT | SizeDescriptor.ABOUT_25, 10)));
			
			
			two_rel.push(new RelationDescription(1,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.WIDTH | SizeDescriptor.LONGER | SizeDescriptor.HALF, 7)));
			
			two_rel.push(new RelationDescription(1,4,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.INSIDE_WHOLE, 7)));
			
			
			two = new ShapeModel(Character.TWO, two_prim, two_ref, two_rel, new Array(), name);
			
			return two;	
		}
		
		//---------------------------------------------------

	}
}